<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    let a = [1,12,31,23,123,1,42,34,34,5,34,2,4,124,1,2,5,3,423,4,234];
    let max = a[0];
    let min = a[0];
    let sum = 0;

    for (let v of a) {
        //最大值
        if (v > max) {
            max = v;
        }
        // 最小值
        if (v < min) {
            min = v;
        }
        // sum = sum + v
        sum += v;
    }

    console.log("最大值：",max);
    console.log("最小值：",min);
    console.log("和：",sum);
    console.log("平均值：",sum / a.length);
</script>
</html>